package com.qianfeng.teachdemo.adapter;

import java.util.List;

import com.lidroid.xutils.ViewUtils;
import com.lidroid.xutils.view.annotation.ViewInject;
import com.qianfeng.teachdemo.R;
import com.qianfeng.teachdemo.bean.MenuBean;

import android.content.Context;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.TextView;

public class LeftAdapter extends MeBaseAdapter<MenuBean> {


    public LeftAdapter(Context context, List<MenuBean> list) {
        super(context, list);
    }

    @Override
    public View createView(int position, View view, ViewGroup viewGroup) {
        ViewHolder vh = null;
        if (view == null) {
            view = inflater.inflate(R.layout.menu_left_item_layout, viewGroup,false);
            vh = new ViewHolder();
            ViewUtils.inject(vh, view);
            view.setTag(vh);
        } else {
            vh = (ViewHolder) view.getTag();
        }
        vh.headTv.setText(list.get(position).getName());
        vh.icon.setImageResource(list.get(position).getResId());
        return view;
    }

    private final class ViewHolder {
		@ViewInject(R.id.menu_lfet_item_tv)
		private TextView headTv;
		@ViewInject(R.id.menu_lfet_item_iv)
		private ImageView icon;

	}

}
